<#include "/includes/vars.inc">  
<@pp.dropOutputFile />
<#list entities.entity as entity>
    <#assign entityName = entity.@name>
    <#assign managedBean = entity.@name?uncap_first+"Controller">
        <#list entity["one-to-one"] as rel>
        	<#if rel.@mappedBy??>
        	<#assign entityRel = rel.@name>
        	<@pp.changeOutputFile name="${webDir}/jeecode/"+entity.@name?uncap_first+"/include/"+entity.@name?cap_first+"${entityRel?cap_first}OTO.xhtml" />
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition>
             
        <p:tabView id="tab${entityName}">
            <p:tab title="${r"#{"}msg.${entityName?uncap_first}Edit${r"}"}">
            <p:messages id="errors"
                            redisplay="false" />
                <h:panelGroup id="data">
                    <h:panelGrid columns="2" cellpadding="5">
                        <ui:include src="/jeecode/${entityName?uncap_first}/include/${entityName}DataEdit.xhtml" />
                    </h:panelGrid>
                    <p:separator />
                    <p:commandButton update="errors"
                                     icon="ui-icon ui-icon-disk"
                                     actionListener="${r"#{"}${managedBean}${r".save}"}"
                                     value="${r"#{"}msg.save}"
                                     />
                </h:panelGroup>
            </p:tab>

            <!--  Relationships -->
            <#list entity["one-to-one"] as rel >
            	<#if entity.@parent[0]?? && entity.@parent[0]!=rel.@entity>
            <p:tab title="${rel.@name?cap_first}">
                <ui:include src="/include/${entityName?uncap_first}/${rel.@entity?cap_first}${entityName}OTO.xhtml" />
            </p:tab>
            	</#if>
            </#list>
            <#--
            <#list entity["many-to-one"] as rel >
            <p:tab title="${rel.@name?cap_first}">
                <ui:include src="/include/${entityName?uncap_first}/${entityName}${rel.@entity?cap_first}MTO.xhtml" />
            </p:tab>
            </#list>
              -->
            <#list entity["one-to-many"] as rel >
             <p:tab title="${rel.@name?cap_first}">
                <h:form id="form${rel.@entity}List">
                    <ui:include src="/jeecode/${rel.@entity?uncap_first}/include/${rel.@entity}List.xhtml"/>
                </h:form>
                <h:form id="form${rel.@entity}Create">
                    <ui:include src="/jeecode/${rel.@entity?uncap_first}/include/${rel.@entity}Create.xhtml" />
                </h:form>
                <h:form id="form${rel.@entity}Edit">
                    <ui:include src="/jeecode/${rel.@entity?uncap_first}/include/${rel.@entity}Edit.xhtml" />
                </h:form>
                <h:form id="form${rel.@entity}Delete">
                    <ui:include src="/jeecode/${rel.@entity?uncap_first}/include/${rel.@entity}Delete.xhtml"/>
                </h:form>
            </p:tab>
            </#list>
            <#list entity["many-to-many"] as rel >
            <p:tab title="${rel.@name?cap_first}">
                <h:form id="form${entityName}${rel.@entity?cap_first}MTM">
                    <ui:include src="/jeecode/${entityName?uncap_first}/include/${entityName}${rel.@entity?cap_first}MTM.xhtml" />
                </h:form>
            </p:tab>
            </#list>
        </p:tabView>    
    
    </ui:composition>

</html>
			</#if>
        </#list>
</#list>